package com.chis.cq;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2020年01月12日
 */
public class UnitAttr {
    public static void main(String[] args) throws Exception {
        File file1 = new File("C:\\Users\\Administrator\\Desktop\\国家对接二阶段\\重庆市\\重庆\\数据导入\\unitattr5.txt");
        FileReader m = new FileReader(file1);
        BufferedReader reader = new BufferedReader(m);
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if (nextline != null) {
                    String[] strings = nextline.split("#");
                    String ss1 = "INSERT INTO TS_UNIT_ATTR(UNIT_CODE,UNIT_ATTR_CODE,DELMARK,CREATE_DATE) VALUES (\""+strings[0]+"\",\""+"1003"+"\",0,NOW())  ON DUPLICATE KEY UPDATE MODIFY_DATE=NOW();";
                    System.out.println(ss1);
                    for(String d : strings[1].split(",")){
                        String ss2 = "INSERT INTO TS_UNIT_ATTR(UNIT_CODE,UNIT_ATTR_CODE,DELMARK,CREATE_DATE) VALUES (\""+strings[0]+"\",\""+d+"\",0,NOW())  ON DUPLICATE KEY UPDATE MODIFY_DATE=NOW();";
                        System.out.println(ss2);
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }
    }
}
